<template>
  <div id="app">
    <router-view/>
  </div>
</template>


<script>
export default {
  name:'app',
  created (){
    //在页面加载时读取sessionStorage
    if(sessionStorage.getItem("user")){
      let perms = JSON.parse(sessionStorage.getItem("user"));
      this.$store.dispatch("SET_PERMISSION",perms.permission);
    }
    //在页面刷新时将 store 保存到 sessionStorage 里面
    // window.addEventListener('beforeunload',()=>{
    //   let a = this.$store.state;
    //   console.log("fdafd"+JSON.stringify(a));
    //   sessionStorage.setItem('store',JSON.stringify(a) )
    // })
  }
}

</script>

<style >
body,html,#app{
  width: 100%;
  height: 100%;
}
body{
  margin: 0;
  padding: 0;
}
</style>
